﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OverSATbLib
{
    public class Assignment
    {
        public string Name;
        public int NameId;
        public uint Value;
        public int Index;

        public static AssignmentEquality AssignmentEquality = new AssignmentEquality();

        public override bool Equals(object obj)
        {
            Assignment ax = obj as Assignment;
            return NameId == ax.NameId && Value == ax.Value;
        }

        public override int GetHashCode()
        {
            return NameId ^ (int)Value;
        }
    }

    public class AssignmentEquality : IEqualityComparer<Assignment>
    {
        public bool Equals(Assignment x, Assignment y)
        {
            return x.NameId == y.NameId && x.Index == y.Index;
        }

        public int GetHashCode(Assignment obj)
        {
            return obj.NameId ^ (int)obj.Value;
        }
    }
}
